package com.ruoyi.framework.web.domain;

import java.util.Date;
import cn.hutool.core.date.DateUtil;

public class IdCard {

	private String name;
	
	private String number;
	
	private String timelimit;
	
	private String year;
	
	private String month;
	
	private String day;
	
	private Date birthday;
	
	private Integer age;
	
	private String sex;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getNumber() {
		return number;
	}

	public void setNumber(String number) {
		this.number = number;
	}

	public String getTimelimit() {
		return timelimit;
	}

	public void setTimelimit(String timelimit) {
		this.timelimit = timelimit;
	}

	public String getYear() {
		return year;
	}

	public void setYear(String year) {
		this.year = year;
	}

	public String getMonth() {
		return Integer.parseInt(month) < 10 ? "0"+month : month;
	}

	public void setMonth(String month) {
		this.month = month;
	}

	public String getDay() {
		return Integer.parseInt(day) < 10 ? "0"+day : day;
	}

	public void setDay(String day) {
		this.day = day;
	}

	public Date getBirthday() {
		String date = this.getYear()+"-"+this.getMonth()+"-"+this.getDay()+" "+"00:00:00";
		this.birthday = DateUtil.parseDateTime(date);
		return birthday;
	}

	public Integer getAge() {
		this.age = DateUtil.ageOfNow(getBirthday());
		return age;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	public String getSex() {
		this.sex = this.sex.equals("男") ? "0":"1";
		return sex;
	}

}
